<!-- 纠错问题 -->
<template>
    <div class="correctAudit">
        <div class="header flexbetween mb20">
            <div>
                <el-select size="small" style="width:200px" v-model="status" class="mr20">
                    <el-option label="所有状态" value=""></el-option>
                    <el-option label="待审核" value="1"></el-option>
                    <el-option label="已通过" value="2"></el-option>
                    <el-option label="已驳回" value="3"></el-option>
                </el-select>
                <el-dropdown class="mr20" trigger="click">
                    <span class="el-dropdown-link" style="width: 200px">
                        批量操作<i class="el-icon-arrow-down el-icon--right"></i>
                    </span>
                    <el-dropdown-menu slot="dropdown" style="width: 200px">
                        <el-dropdown-item>批量删除</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
                <el-input v-model="searchInput" placeholder="请输入内容" size="small" style="width:300px;">
                    <el-select v-model="keywordType" size="small" style="width:100px" slot="prepend">
                        <el-option label="按问题" value="question"></el-option>
                        <el-option label="按答案" value="answer"></el-option>
                    </el-select>
                    <span slot="suffix" class="iconfont icon-sousuo"></span>
                </el-input>
            </div>
            <div class="iconBtn">
                <el-tooltip effect="light" content="高级筛选" placement="top" :enterable="false">
                    <span class="iconfont icon-shaixuan"></span>
                </el-tooltip>
                <el-tooltip effect="light" content="导入" placement="top" :enterable="false" class="ml20">
                    <span class="iconfont icon-daoru"></span>
                </el-tooltip>
            </div>
        </div>
        <element-table :data="questionList" :columns="cloumns" :tableHeight="tableHeight" :pageNo="pageNo" :pageSize="pageSize"
                       :total="total" @changePageNo="changePageNo" @changePageSize="changePageSize" isNeedSelect>
        </element-table>
    </div>
</template>

<script>
import elementTable from "@/components/elementTable";
import { getQueList } from "@/api/knowledge.js";
export default {
    name: "correctAudit",
    props: {
        classId: {
            type: String,
        },
    },
    data() {
        return {
            questionList: [],
            pageNo: 1,
            pageSize: 10,
            total: 0,
            status: "",
            keywordType: "question",
            searchInput: "",
            cloumns: [
                {
                    config: {
                        label: "标准问",
                        prop: "question",
                        width: "250"
                    },
                },
                {
                    config: {
                        label: "答案数",
                        prop: "answerCount",
                    }
                },
                {
                    config: {
                        label: "所属分类",
                        prop: "question",
                    }
                },
                {
                    config: {
                        label: "创建人员",
                        prop: "question",
                    }
                },
                {
                    config: {
                        label: "创建时间",
                        prop: "addTime",
                        width: "170"
                    }
                },
                {
                    config: {
                        label: "状态",
                        prop: "status",
                    }
                },
                {
                    config: {
                        label: "操作",
                        prop: "question",
                    },
                    render: (h, scope) => {
                        return (
                            <div class="operation">
                                <el-tooltip effect="light" content="审核" placement="top" enterable={false}>
                                    <span class="iconfont icon-bianjidaan"></span>
                                </el-tooltip>
                            </div>
                        );
                    },
                },
            ]
        }
    },
    created() {
        this.getQueList();
    },
    methods: {
        getQueList() {
            var param = {
                pageNo: this.pageNo,
                pageSize: this.pageSize,
            }
            getQueList(param).then((resp) => {
                if (resp.status == 0) {
                    this.total = resp.data.total;
                    this.questionList = resp.data.questionList || [];
                }
            });
        },
        changePageSize(val) {
            this.pageSize = val;
        },
        changePageNo(val) {
            this.pageNo = val;
        },
    },
    computed: {
        tableHeight() {
            return document.body.clientHeight - 300;
        },
    },
    components: {
        elementTable
    }
}
</script>

<style lang="scss">
.correctAudit {
}
</style>